package com.wutianyi.module.commons;

import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.TypeHandler;


@SuppressWarnings("rawtypes")
public class PropertyGroupTypeTypeHandler implements TypeHandler {

	@Override
	public void setParameter(PreparedStatement ps, int i, Object parameter,
			JdbcType jdbcType) throws SQLException {
		// TODO Auto-generated method stub

	}

	@Override
	public Object getResult(ResultSet rs, String columnName)
			throws SQLException {
		if (null != rs) {
			int v = rs.getInt(columnName);
			if (v == 0) {
				return PropertyGroupType.STANDARD;
			} else {
				return PropertyGroupType.CUSTOMER;
			}
		}
		return null;
	}

	@Override
	public Object getResult(CallableStatement cs, int columnIndex)
			throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

}
